package top.lingchen.blogadmin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import top.lingchen.blogadmin.bean.Admin;
import top.lingchen.blogadmin.bean.Permission;

import java.util.List;

/**
 * @Author 凌宸
 * @create 2021-12-20 下午 2:28
 * @Description
 * @Version 1.0
 */
@Repository
public interface AdminMapper extends BaseMapper<Admin> {
    /**
     * 根据管理员 id 查询 权限路径列表
     * @param adminId
     * @return
     */

    @Select("select * from ms_permission " +
            "where id in " +
            "(select permission_id " +
            "from ms_admin_permission " +
            "where admin_id = #{adminId})"
    )
    List<Permission> findPermissionByAdminId(Long adminId);
}
